/**
 * 
 */
package ocumed.domaene.tests;

import ocumed.applikation.exceptions.VersNummerStartsWithZeroException;
import ocumed.applikation.exceptions.VersNummerWrongLengthException;
import ocumed.applikation.exceptions.VersNummerWrongPruefzifferException;
import ocumed.domaene.patientenverwaltung.DPatient;
import junit.framework.TestCase;

/**
 * @author rudi
 *
 */
public class TestVersNr extends TestCase {
    
    public void testValidVersNr() {
        String valid = "2482120185";
        
        DPatient dp = new DPatient(valid);
        boolean success = true;
        
        try {
            dp.pruefeVersNr();
        } catch (VersNummerStartsWithZeroException e) {
            success = false;
            e.printStackTrace();
        } catch (VersNummerWrongLengthException e) {
            success = false;
            e.printStackTrace();
        } catch (VersNummerWrongPruefzifferException e) {
            success = false;
            e.printStackTrace();
        }
        
        assertEquals(success, true);
    }
    
    public void testEmptyVersNr() {
        String valid = "";
        
        DPatient dp = new DPatient(valid);
        boolean success = true;
        
        try {
            dp.pruefeVersNr();
        } catch (VersNummerStartsWithZeroException e) {
            success = false;
            e.printStackTrace();
        } catch (VersNummerWrongLengthException e) {
            success = false;
            e.printStackTrace();
        } catch (VersNummerWrongPruefzifferException e) {
            success = false;
            e.printStackTrace();
        }
        
        assertEquals(success, true);
    }

}
